<template>
  <div id="app">
    <h2>测试题</h2>
    <subject >
      <SubjectItem @totalNum="totalNum"></SubjectItem>
    </subject>
    <div>
      <flag>
        <FlagItem :lists="lists"></FlagItem>
      </flag>
    </div>
  </div>
</template>

<script>
import SubjectItem from './components/SubjectItem.vue';
import FlagItem from './components/FlagItem.vue';
export default {
  components:{
    SubjectItem,
    FlagItem
  },
  data(){
    return {
      lists:[]
    }
  },
  methods:{
    totalNum(value1,value2){
      console.log(value2)
      if(value1 === value2){
        this.lists.push({
          answer:'回答正确',
          alias:'right'
        })
      }else if(value1 !== value2){
        if(value2 === undefined){
          this.lists.push({
          answer:'未完成',
          alias:'undo'
        })
      }
      }else {
        this.lists.push({
          answer:'回答错误',
          alias:'error'
        })
      }
    }
  }
};
</script>

<style>
body {
  background-color: #eee;
}

#app {
  background-color: #fff;
  width: 500px;
  margin: 50px auto;
  box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
  padding: 2em;
}
</style>